/**
 *
 * @author 
 *
 */
class CreateObject {
	/**
	* 根据name关键字创建一个Bitmap对象。name属性请参考resources/resource.json配置文件的内容。
	* Create a Bitmap object according to name keyword.As for the property of name please refer to the configuration file of resources/resource.json.
	*/
	public static createBitmapByName(name:string, touch: boolean = false):egret.Bitmap {
    	var result:egret.Bitmap = new egret.Bitmap();
    	var texture:egret.Texture = RES.getRes(name);
    	result.texture = texture;
    	result.touchEnabled = touch;
    	return result;
	}
	
	//创建一个TextField对象
    public static createTextField(x: number, y: number, label: string, width: number = 0, height: number = 34, size: number = 36, color: number = 0xFFFFFF, fontFamily: string = "微软雅黑",align: string = "left"): egret.TextField {
        var labelField: egret.TextField = new egret.TextField();
        labelField.textAlign = align ;
        labelField.type = egret.TextFieldType.DYNAMIC;
        labelField.x = x;
        labelField.y = y;
        labelField.text = label;
        if(width > 0) labelField.width = width;
        labelField.height = height;
        labelField.height = height;
        labelField.size = size;
        labelField.textColor = color;
        labelField.fontFamily = fontFamily;
        return labelField;
    }
	
	//创建一个TextField对象
    public static createETextField(x: number, y: number, label: string, width: number = 0, height: number = 34, size: number = 36, color: number = 0xFFFFFF, fontFamily: string = "微软雅黑",align: string = "left"): ETextField {
        var labelField: ETextField = new ETextField();
        labelField.textAlign = align ;
        labelField.type = egret.TextFieldType.DYNAMIC;
        labelField.x = x;
        labelField.y = y;
        labelField.text = label;
        if(width > 0) labelField.width = width;
        labelField.height = height;
        labelField.size = size;
        labelField.textColor = color;
        labelField.fontFamily = fontFamily;
        return labelField;
    }
	
	//创建一个InputText对象
    public static createInputText( x:number, y:number, label:string,  width:number = 180,  height:number = 34,  size:number = 36,  color:number = 0xFFFFFF, editable:boolean = false ):egret.TextField
    {
        var input:egret.TextField = new egret.TextField();
        input.textAlign = "center";
        input.type = egret.TextFieldType.INPUT;
        input.x = x;
        input.y = y;
        input.text = label;
        input.width = width;
        input.height = height;
        input.displayAsPassword = editable;
        return input;
    }
}
